package com.wmzdq.framework.controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.wmzdq.dto.Tmenu;
import com.wmzdq.dto.TroleMenu;
import com.wmzdq.framework.constant.Constants;

@RestController
@RequestMapping(value="/menu")
public class MenuController extends BaseController {
	
	@RequestMapping(value="getUserMenu",method=RequestMethod.GET)
	public String getMenuLogin(HttpServletRequest request){
		HttpSession session=request.getSession();
		List<Tmenu> menus=(List<Tmenu>)session.getAttribute(Constants.USER_MENUS);
		List<Tmenu> result=new ArrayList<Tmenu>();
		for (Tmenu tmenu : menus) {
			if(tmenu.getType()==1)
				result.add(tmenu);
		}
		return JSON.toJSONString(result);
		
	}

}
